from tokenizer import Tokenizer
from parser import Parser
from formatter import Formatter
from checker import Checker

res = Parser(Tokenizer('''
module 'a'
def O <X> {
    x: X
    a: Any
}
def A <T, U> : O <List<List<U>>> {
    t: T
    u: U
}
def B <T, U> : A <T, Set<U>> {
    b: T
}
def C <V> : B<V, String> {
    v: V
}
def D : C <Int> {}
def E <W> : D {
    w: W
}
E<Any> {
    w: 'any',
    v: 1,
    b: 2,
    t: 3,
    u: ('abc'),
    x: [[('def')]],
    a: {a:1}
}
''')).parse()

ls = Formatter().format([res], [])

Checker.check_def_type(ls[0]['def'][1])

res_from_checker = Checker.list_all_members_of(ls[0]['value'].type_ref_symbol)
print (','.join(str(e) for e in res_from_checker))
obj = res['value']
Checker.check_value(obj.type_ref_symbol, True, obj.value)

res = obj.value.res_value
print (res)
print ('')
print ('\n'.join(str(type(res[k])) for k in res))
